﻿Imports EnvDTE80
Imports EnvDTE
Imports System.Collections.Generic
Imports System.Linq

Public Class SimpleLinkingProvider
  Inherits BaseProvider

  Public Overrides Sub Run(app As DTE2)
    Dim phs = ExtractProjectHolders(app.Solution.Projects)
    phs.Sort()

    Dim sourceProject As ProjectHolder = SelectSingleProject(phs, "Select source project:")
    If sourceProject Is Nothing Then Return

    Dim targetProjects = SelectMultipleProjects(phs.CloneWithout(sourceProject), "Select target projects:")
    If targetProjects Is Nothing OrElse targetProjects.Count = 0 Then Return

    Dim sett = GetCopyProviderSettings()

    Dim resultDataSet = CopyProvider.DoLinking(sourceProject, targetProjects, sett)

    Dim f As New FrmResults

    f.SetResultDataSet(resultDataSet)
    f.Show()
  End Sub

End Class
